package com.block;

import io.netty.util.HashedWheelTimer;
import io.netty.util.Timeout;
import io.netty.util.Timer;
import io.netty.util.TimerTask;

import java.util.concurrent.TimeUnit;

/**
 * @auther: cc.ly
 * @date: 2018/12/20/020
 */

public class TestRun {
    public static void main(String[] args) {
//        ScheduledExecutorService respScheduler = new ScheduledThreadPoolExecutor(2);
//
//        respScheduler.schedule(new Runnable() {
//            @Override
//            public void run() {
//                System.out.println("run.");
//            }
//        },2, TimeUnit.SECONDS);

        final Timer timer = new HashedWheelTimer();
        timer.newTimeout(new TimerTask() {
            public void run(Timeout timeout) throws Exception {
                System.out.println("timeout 1");
            }
        }, 1, TimeUnit.SECONDS);

        timer.newTimeout(new TimerTask() {
            public void run(Timeout timeout) throws Exception {
                System.out.println("timeout 2");
            }
        }, 2, TimeUnit.SECONDS);
    }
}
